package com.lc.luzhengtang.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lc.luzhengtang.R;
import com.lc.luzhengtang.bean.ShopDetailBean;
import com.lc.luzhengtang.conn.Conn;
import com.lc.luzhengtang.layoutmanager.FullyGridLayoutManager;
import com.lc.luzhengtang.view.GlideCircleTransform;
import com.zcx.helper.scale.ScaleScreenHelperFactory;

import java.util.ArrayList;
import java.util.List;

/**
 * 文 件 名: NewsListAdapter
 * 创 建 人: zhangyu
 * 创建日期: 16/12/24 19:55
 * 邮   箱: yuanchong121@gmail.com
 * 修改时间：
 * 修改备注：
 */
public class EvaluateListAdapter extends BaseQuickAdapter<ShopDetailBean.DataBeanX.EvaluateBean.DataBean, BaseViewHolder> {


    RecyclerView recyclerView;
    List<String> urls = new ArrayList<>();
    FullyGridLayoutManager fullyGridLayoutManager;
    PhotoItemAdapter photoItemAdapter;

    PhotoItemAdapter myPhotoAdapter;
    List<ShopDetailBean.DataBeanX.EvaluateBean.DataBean> data = new ArrayList<>();

    public EvaluateListAdapter(List<ShopDetailBean.DataBeanX.EvaluateBean.DataBean> data) {

        super(R.layout.item_evaluate, data);

    }


    @Override
    protected void convert(BaseViewHolder helper, ShopDetailBean.DataBeanX.EvaluateBean.DataBean item) {
        ScaleScreenHelperFactory.getInstance().loadView((ViewGroup) helper.convertView);

        helper.setText(R.id.text_newstitle, item.getContent());
        helper.setText(R.id.text_newstime, item.getEval());
        //  Glide.with(mContext).load(Conn.HOST2+ item.getPicarr()).transform(new GlideCircleTransform(mContext)).into((ImageView) helper.getView(R.id.img_person));
        // Glide.with(mContext).load("http://img4.imgtn.bdimg.com/it/u=3432487329,2901563519&fm=26&gp=0.jpg").transform(new GlideCircleTransform(mContext)).into((ImageView) helper.getView(R.id.img_person));
        Glide.with(mContext).load(Conn.HOST2 + item.getPicarr()).transform(new GlideCircleTransform(mContext)).error(R.mipmap.zhanwei).placeholder(R.mipmap.zhanwei).into((ImageView) helper.getView(R.id.img_person));
        // helper.setText(R.id.text_tiem, item.getCreate_time());
        helper.setText(R.id.text_content, item.getContent());
        recyclerView = helper.getView(R.id.recyclerView_photolist);
        fullyGridLayoutManager = new FullyGridLayoutManager(mContext, 4);
        recyclerView.setLayoutManager(fullyGridLayoutManager);
        photoItemAdapter = new PhotoItemAdapter(item);
        recyclerView.setAdapter(photoItemAdapter);


    }


    protected class PhotoOneAdapter extends BaseQuickAdapter<ShopDetailBean.DataBeanX.EvaluateBean.DataBean, BaseViewHolder> {

        public PhotoOneAdapter(List<ShopDetailBean.DataBeanX.EvaluateBean.DataBean> data) {
            super(R.layout.item_photo, data);
        }

        @Override
        protected void convert(BaseViewHolder helper, ShopDetailBean.DataBeanX.EvaluateBean.DataBean item) {
            ScaleScreenHelperFactory.getInstance().loadView((ViewGroup) helper.convertView);
            for (int i = 0; i < item.getEvaluate().length(); i++) {

            }

            Glide.with(mContext).load(Conn.HOST3 + item.getPicarr()).transform(new GlideCircleTransform(mContext)).error(R.mipmap.ic_launcher).into((ImageView) helper.getView(R.id.img_comment_item));
        }
    }


}
